function chunk(arr, size = 1) {
  let result = [];

  let temp = [];

  arr.forEach((item) => {
    if (temp.length === 0) {
      result.push(temp);
    }

    temp.push(item);

    if (temp.length === size) {
      temp = [];
    }
  });

  return result;
}
